UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'UmrGuSkXb/7p6tb3DUk6DLJEZsNsbAQhsCZ8al3b9I8='
WHERE
key_id = 'd65229763dbdae750731c5ea7a5d3afed0f613337dc49c8096c9758b23f3c21f'
AND (
token = 'UmrGuSkXb/7p6tb3DUk6DLJEZsNsbAQhsCZ8al3b9I8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)