UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0V0LexzaO7uCSeC/6WTbXYim9SD79Q6Ui3Z4vfHqWnY='
WHERE
key_id = 'a12fd8f6a6e1e4bb8e92c14df8faecd2e2c58a1d680db27b7571ff03107df9b1'
AND (
token = '0V0LexzaO7uCSeC/6WTbXYim9SD79Q6Ui3Z4vfHqWnY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)