UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'g7hDJJIUjLNG5H8CMppA99hGF4yn+w4Ylf1uqQdze/Q=' 
WHERE 
  key_id = 'ecdda8d18e213952589c0f2ce4a3bb295ac258c63717c65faa30f36a4e01df9f' 
  AND (
    token = 'g7hDJJIUjLNG5H8CMppA99hGF4yn+w4Ylf1uqQdze/Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016