UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6ohsqEIjFeL2AAso1xnw+JKP05L+shQocCGiCCcWXZw='
WHERE
key_id = '66fbed76bae83e751a61fe3ddf8d8b644ade886d048187a3936c333bbe49579f'
AND (
token = '6ohsqEIjFeL2AAso1xnw+JKP05L+shQocCGiCCcWXZw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)