UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'f6rNY8gB/lcidHsYmR5/rh2SLcO9Lz8H2ryHLjX56w8='
WHERE
key_id = 'e393d3a92e69396d67050f1da65f0213157b5f16bbf06e32edbd3427bbc94d3a'
AND (
token = 'f6rNY8gB/lcidHsYmR5/rh2SLcO9Lz8H2ryHLjX56w8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)