UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sDZI9Ig+d+FzYg/9nAhu+muJWTqnk94Hw2AoXeF9UAI='
WHERE
key_id = '06b9af27408d0dfed8050b6c30d30b648062ca8434e0360f395f4d37b755668e'
AND (
token = 'sDZI9Ig+d+FzYg/9nAhu+muJWTqnk94Hw2AoXeF9UAI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)