UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HLP0urX8uZVcW7vE1q3JgdsVxDql809kh147QZnP+rk='
WHERE
key_id = '5831f86d376893c7dce5dfeb9ad3f5dbd6d6dcb95b43d85499e6b760b1cfa296'
AND (
token = 'HLP0urX8uZVcW7vE1q3JgdsVxDql809kh147QZnP+rk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)