UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'j1mOZKHGTf7xGJB8WTq83EhG3ArJzfaxVsrgvfmwgKE=' 
WHERE 
  key_id = '7b5064b62fa8a1390a5b1b90c4cbaa689168d2be2342df6fd3fe20e1c5ae6a10' 
  AND (
    token = 'j1mOZKHGTf7xGJB8WTq83EhG3ArJzfaxVsrgvfmwgKE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023