UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sRtzylR6Yw9u9Ck66Ve7I77U6juciW5NA1cfhw2tyxg='
WHERE
key_id = 'fddc46af86d705ca5b85f080c7b8b1524fc243d918cf86564a862b78a84c00a6'
AND (
token = 'sRtzylR6Yw9u9Ck66Ve7I77U6juciW5NA1cfhw2tyxg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)