UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YBZm319EHwnXkCoJLCgw31OcXiV3VD8yek26vv+xk38=' 
WHERE 
  key_id = '8d6a3fd432a56d8fc8a7d2ce0d33c8254bc994b145ef351c38c1aa54b0fa6224' 
  AND (
    token = 'YBZm319EHwnXkCoJLCgw31OcXiV3VD8yek26vv+xk38=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053