UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xZonMubVOhuHLV8wLy1lqQooPp7fmyrPsqR3SgB334s='
WHERE
key_id = 'd138eb7e09526743b4d25b57b401eabc72ddcd280d11c99576865de7899dc999'
AND (
token = 'xZonMubVOhuHLV8wLy1lqQooPp7fmyrPsqR3SgB334s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)