UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XEBw2RMdYF6Yg3z1K7DResJu9OPZxHk15I17yMaqxw4=' 
WHERE 
  key_id = '456e04f725a68826f3ad8ca73f67c92aa9e242e21deca1c16471631a96a07aef' 
  AND (
    token = 'XEBw2RMdYF6Yg3z1K7DResJu9OPZxHk15I17yMaqxw4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032