UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HCzmDdc14BywFaLuRKQ0WMdBRqnoLolszp5ghrw0oqY=' 
WHERE 
  key_id = 'ab1ad647f373adcae9d9f2e45e000b42553c39af62807171b1953438e63d6952' 
  AND (
    token = 'HCzmDdc14BywFaLuRKQ0WMdBRqnoLolszp5ghrw0oqY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044