UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aK87UmdWqc4BmR/5fH0o/JEUT3lx1pmM2OH1Qdl98Ws=' 
WHERE 
  key_id = '9b4449915ce31a48d0bc94694e8ec6356d1c86c8e0be184b67778899e16b4d7e' 
  AND (
    token = 'aK87UmdWqc4BmR/5fH0o/JEUT3lx1pmM2OH1Qdl98Ws=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016