UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'DZhJzwib7oX1Dy7SHc4lie42UFbzrL12XIA56/utu7w='
WHERE
key_id = 'e789ffab3ec81fc1e119986715c7c24f7f846919136387d3f4e12bbae663984a'
AND (
token = 'DZhJzwib7oX1Dy7SHc4lie42UFbzrL12XIA56/utu7w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)