UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ul/r50CmWrfW0AB6AIIHs0+pn7GOYTQuvqF/2b6Sn8g=' 
WHERE 
  key_id = '85a3fccd885781ab4c1318dc548e41154ad4b858ce29307f52050f2feb44bcfe' 
  AND (
    token = 'ul/r50CmWrfW0AB6AIIHs0+pn7GOYTQuvqF/2b6Sn8g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042