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