UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '/scy327v1Qi2u0qyK4pTB4uPpF96IS+rvHhb7hLE+xs='
WHERE
key_id = '779aec87c953200a3c8e3edbce253070d1936bfa80b518c20a887419eede49b4'
AND (
token = '/scy327v1Qi2u0qyK4pTB4uPpF96IS+rvHhb7hLE+xs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)