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

Query time 0.00027