UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yaey6KK8/h+Jz8LAg/mheArt2NrvO0SUJMMYWcwCiME=' 
WHERE 
  key_id = '346c0e2214d23db1e3a774a7cede243c002044d8aee72d6690e35cf4358a4690' 
  AND (
    token = 'yaey6KK8/h+Jz8LAg/mheArt2NrvO0SUJMMYWcwCiME=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033