UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pNqXSnpBCq0lGA1VWDAPx92+j4JTDxUxnTi1Igoj5yc=' 
WHERE 
  key_id = '430991eb1f2e4dcc0645bd68ebdfe84d0ab0b3e6b9ecd487135cdaee17571297' 
  AND (
    token = 'pNqXSnpBCq0lGA1VWDAPx92+j4JTDxUxnTi1Igoj5yc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038