UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZaAzfI5zpW5oVChoO4MHGao1yJJVk0Ty06a/+/nI1Sc='
WHERE
key_id = '40708eded04e42793249ff4d0020bad0a3d99dc56b3338560891948525067daa'
AND (
token = 'ZaAzfI5zpW5oVChoO4MHGao1yJJVk0Ty06a/+/nI1Sc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)