UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ocn4efkfzkL1MO2xjsfe/2HU97Stg5sDP8lP2v9Bu0Q=' 
WHERE 
  key_id = '3b2d71364bc51727a73dc5fe03443b89c9599fa14a2e422cade8547f155367b2' 
  AND (
    token = 'ocn4efkfzkL1MO2xjsfe/2HU97Stg5sDP8lP2v9Bu0Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046