UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'N1L5y7KE7EbAKWkW414Ac41ZOWbqIlTAPAfBHo+1nNE='
WHERE
key_id = '558bda4b6a2c9c126ffe31500274b2c5116bd00924e4b698321dead001400d08'
AND (
token = 'N1L5y7KE7EbAKWkW414Ac41ZOWbqIlTAPAfBHo+1nNE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)