UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qerdWvuzeO646lbuw3D4o+wCfg70a5BEEZ1QQ7SZzqM=' 
WHERE 
  key_id = '2bdae8d7d97edbb1fe459c737b239546d85b47a6dd3e07f4399c6749a9e3db08' 
  AND (
    token = 'qerdWvuzeO646lbuw3D4o+wCfg70a5BEEZ1QQ7SZzqM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040