UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '+pW+ZCyeLcX652d7saTbBTcroPwT7dBfY18kAUWNYO0='
WHERE
key_id = '25fb822938d80cde993c70fa096d753e49f5abca63d7c8b33fd646b7b3443832'
AND (
token = '+pW+ZCyeLcX652d7saTbBTcroPwT7dBfY18kAUWNYO0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)