UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'N8XZD89OMLPY03VAcgvh8LFaSDMrw3a1809Df1tR5zQ='
WHERE
key_id = '97d665f2a0ea5fd20e09959957202f20ca432463067c64dfffcd63b6b96fb3a0'
AND (
token = 'N8XZD89OMLPY03VAcgvh8LFaSDMrw3a1809Df1tR5zQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)