UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Qj+jM5x7XKdgoQhMSRETtnGkkGgLXUwAmYfvjXJ6C5Y='
WHERE
key_id = 'b1c6db8398dcb252146e72a8c4915ab289fa8af302fc1acf60f38ca1c241e636'
AND (
token = 'Qj+jM5x7XKdgoQhMSRETtnGkkGgLXUwAmYfvjXJ6C5Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)