UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bKCxuUxtnZp0BOiMGiTcIq/7/BFJEs/akYif2U7rceI='
WHERE
key_id = 'c11db54618a06454e5f46da8ae46e62be995ea993fd5868ec02e4a821d17e96a'
AND (
token = 'bKCxuUxtnZp0BOiMGiTcIq/7/BFJEs/akYif2U7rceI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)