UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RGf5uU+xzaktUkK1/s7iG/vRewgZySN/fP9tAar3ACY='
WHERE
key_id = 'b95d370ee8f8783d31f68afd2d22661d805454cbb532b748855a681e4beade0a'
AND (
token = 'RGf5uU+xzaktUkK1/s7iG/vRewgZySN/fP9tAar3ACY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)