UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5JVr/drNc4RtwvIJ96tCQ0nlu2HBjQnsCzyOIEtMZUk='
WHERE
key_id = 'd4766e7b42155ad1c46ef108ae3c3f5d5a75d694c8caac478268a78b52cd045f'
AND (
token = '5JVr/drNc4RtwvIJ96tCQ0nlu2HBjQnsCzyOIEtMZUk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)