UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'q0CGLEWBZsxluadVJ0+HHcoAQHxgzq6iha8AI1JE4wg='
WHERE
key_id = 'd87a4189db1651b35abfac9757f8dc3b7311bb353ccba5207f47e088e55a1a3a'
AND (
token = 'q0CGLEWBZsxluadVJ0+HHcoAQHxgzq6iha8AI1JE4wg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)