UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JMZFvesLlSRWxbqukM3Plt83DfV1P59y6CXVu9GxfLs=' 
WHERE 
  key_id = 'fd001e88c3bac4d716282b0fe1e5a82a1c50190fea8df4c7ea005a9216e3841d' 
  AND (
    token = 'JMZFvesLlSRWxbqukM3Plt83DfV1P59y6CXVu9GxfLs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052