UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dPShyieD5926hBLsFFCXgUdmCi0ZOBS0A2CLlkYXHcg='
WHERE
key_id = '066c820784c6f533cf3c953d7e98507278713d06bd35dd04f120d92c744bddda'
AND (
token = 'dPShyieD5926hBLsFFCXgUdmCi0ZOBS0A2CLlkYXHcg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)