UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RJnbIK1cZs/Fl2Vfo9K1REaGpS0G0OqexeVlzOe7LfA=' 
WHERE 
  key_id = '7cabb551bae6b961e4ae6692f8577b68eacc6c73c95f1ec120dabe5f2ed759fc' 
  AND (
    token = 'RJnbIK1cZs/Fl2Vfo9K1REaGpS0G0OqexeVlzOe7LfA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016