UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PstesMUy0mhGbHp6Wapq70iwC2FuURZd8J6TFofbbRw='
WHERE
key_id = '39903a45851ae31cf0b63b95517617be08679a0b511ab4f73a403bbd6e26a028'
AND (
token = 'PstesMUy0mhGbHp6Wapq70iwC2FuURZd8J6TFofbbRw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)