UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xAjXAH25IiNvSsagh0MAIG1RuWl90Fm59R6bVKop5eA=' 
WHERE 
  key_id = '4aaf82069535bf53f878497a96088043a78b2691fc606f2de5c44172d29cdb92' 
  AND (
    token = 'xAjXAH25IiNvSsagh0MAIG1RuWl90Fm59R6bVKop5eA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038