UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dtYrmgEmU0hb3HaOZ43yvIpJnnielmYssmhiicSbl8g='
WHERE
key_id = '534e619c408cb1f3a290f113753eab862afdaffbc3119b60876f48792fc4f93f'
AND (
token = 'dtYrmgEmU0hb3HaOZ43yvIpJnnielmYssmhiicSbl8g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)