UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iD1COgJlu76l30ystQxBsZZAWNMikuZLZYA2rVZl+KQ='
WHERE
key_id = 'bb78210f07092efc1b6483a3c90f7fa1c8693a5a20f8c715e3769136c25f960b'
AND (
token = 'iD1COgJlu76l30ystQxBsZZAWNMikuZLZYA2rVZl+KQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)