UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZAiwpRkahWE0d1vsyGLuHFNmXk4uq9QglO+4OrA5dtU='
WHERE
key_id = 'd878aaac04c4e65737e313e5359dde36fa6139b84c850dd174c95273fb9a5db8'
AND (
token = 'ZAiwpRkahWE0d1vsyGLuHFNmXk4uq9QglO+4OrA5dtU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)