UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZchVOhIU9D20bVcw/0a23Cf3Ub5iINfKnLKbNIuUq5c=' 
WHERE 
  key_id = 'd3e48f7df4d489766dacdbc70fe29766898e56645a182c6e98dcce844bd56125' 
  AND (
    token = 'ZchVOhIU9D20bVcw/0a23Cf3Ub5iINfKnLKbNIuUq5c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051