UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cRWvHRS+NtAviMpLgT7p4Fl2+ittkGESht3+4FaMxtA=' 
WHERE 
  key_id = '7ba66c5c171011f09695f16d08059382036ac35f2cc4404392c855834859908c' 
  AND (
    token = 'cRWvHRS+NtAviMpLgT7p4Fl2+ittkGESht3+4FaMxtA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046