UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gbkFpXL9aURJNg+DV3OUxx+4au/znKLa6STSrT9Y68w=' 
WHERE 
  key_id = 'c79c1e6411bd1f0bb27ba01f54bb34f432df38af91490c0de9fdd1d7cab89c8e' 
  AND (
    token = 'gbkFpXL9aURJNg+DV3OUxx+4au/znKLa6STSrT9Y68w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050