UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ka1dvpy7N7vm5uJgtS1wEUt/Fx5aUuShx384viXYLNI='
WHERE
key_id = '87daa0f85c07ef51173233d5025a881f489f3dba2dc7491b9971d7c776c580ed'
AND (
token = 'Ka1dvpy7N7vm5uJgtS1wEUt/Fx5aUuShx384viXYLNI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)