UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'y+lP+QWfFTIacaIkmfgYbH1KThdM7FGGtgK+eicNxjk=' 
WHERE 
  key_id = '7f515e04d538a713c0ffdc71674b88e34ddf228ef6d221bd13f6eca58cddb40f' 
  AND (
    token = 'y+lP+QWfFTIacaIkmfgYbH1KThdM7FGGtgK+eicNxjk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022