UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0oQfZbyPPse4WvIh2yosXuC1jz0KYNmFWXCjGWseTto=' 
WHERE 
  key_id = 'f61d3faf95f4d9709e45f9745f22f9937b519a80c40615d3854197128246c956' 
  AND (
    token = '0oQfZbyPPse4WvIh2yosXuC1jz0KYNmFWXCjGWseTto=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050